<%@page import="entities.Article"%>
<%@page import="java.util.List"%>
<%@page import="entities.Category"%>
<%@page import="entities.User"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.TreeMap"%>
<%
TreeMap check = (TreeMap) request.getAttribute("check");
String form = (String) request.getAttribute("form");
Article article = (Article) request.getAttribute("article");
%>
<jsp:include page="/admin/layouts/header.jsp" />
		<script type="text/javascript" src="/sources/ckeditor/ckeditor.js"></script>
		
		<div class="maincontent noright">
        	<div class="maincontentinner">
                <ul class="maintabmenu multipletabmenu">
                	<li><a href="/admin/article/search">Search Article</a></li>
                	<li class="current"><a href="/admin/article/edit/<%=article.getId() %>">Add Article</a></li>
                </ul><!--maintabmenu-->
                
                <div class="content">
					<jsp:include page="/admin/elements/message_box.jsp" />
					
                    <div class="contenttitle">
                    	<h2 class="form"><span><%=form.equalsIgnoreCase("edit") ? "Edit Article" : "Add Article" %></span></h2>
                    </div><!--contenttitle-->
            
                    <form method="post" action="#" class="stdform stdform2" id="edit_article_form">
                    	
                        <p>
                        	<label>Title</label>
                            <span class="field">
                            	<input type="text" class="smallinput" name="title" id="n_title" value="<%=article.getTitle() != null ? article.getTitle() : "" %>" >
                            	
                            	<% if (check.get("title") != null) { %>
									<label for="n_title" generated="true" class="error"><%=check.get("title") %></label>
								<% } %>
                            </span>
                        </p>
                        
                        <p>
                        	<label>Publish</label>
                            <span class="field formwrapper">
                            		Yes <input class="input type" type="radio" value="true" style="width: auto;" name="published" <%=article.isPublished() == true ? "checked=\"checked\"" : "" %>>&nbsp;&nbsp;&nbsp;&nbsp;
									No <input class="input type" type="radio" value="false" style="width: auto;" name="published" <%=article.isPublished() == false ? "checked=\"checked\"" : "" %>>&nbsp;&nbsp;&nbsp;&nbsp;
								<% if (check.get("published") != null) { %>
									<label for="s_published" generated="true" class="error"><%=check.get("published") %></label>
								<% } %>
                            </span>
                        </p>
                        
                        <p>
                        	<label>Content</label>
                            <span class="field">
                            	<textarea id="n_content" class="longinput ckeditor" name="content"><%=article.getContent() != null ? article.getContent() : "" %></textarea>
                            	<% if (check.get("content") != null) { %>
									<label for="n_content" generated="true" class="error"><%=check.get("content") %></label>
								<% } %>
                            </span>
                        </p>
                        
                        <p class="stdformbutton">
                        	<button class="submit radius2">Submit Button</button>
                            <input type="reset" value="Reset Button" class="reset radius2">
                        </p>
                        
                    </form>
                    
                    <br clear="all">
                    
                </div><!--content-->
                
            </div><!--maincontentinner-->
            
            <jsp:include page="/admin/elements/copyright.jsp" />
            
        </div>

<jsp:include page="/admin/layouts/footer.jsp" />